package com.admission.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.PropertyFilter;

import com.admission.dao.AdmissionPolicyDao;
import com.admission.model.AdmissionPolicy;

@Transactional
@Repository
public class AdmissionPolicyManager {
	private AdmissionPolicyDao admissionPolicyDao;

	public AdmissionPolicy getById(String id) {
		return admissionPolicyDao.findUniqueBy("id", id);
	}
	
	public void saveAdmissionPolicy(AdmissionPolicy entity) {
		admissionPolicyDao.save(entity);
	}
	
	public Page<AdmissionPolicy> searchAdmissionPolicy(
			Page<AdmissionPolicy> page, List<PropertyFilter> filters) {
		return admissionPolicyDao.findPage(page, filters);
	}
	
	@Autowired
	public void setAdmissionPolicyDao(AdmissionPolicyDao admissionPolicyDao) {
		this.admissionPolicyDao = admissionPolicyDao;
	}

	public void deleteAdmissionPolicyByIds(String ids){
		for(String id : ids.split(",")){
			admissionPolicyDao.delete(id.trim());
		}
	}
	
}
